<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 100px;
            height: 100px;
            background-color: red;
            margin: 50px 0 0 50px;
        }
    </style>
    <script>
        window.onload = function(){
            function $(id){
                return document.getElementById(id);
            }
            $("box1").style.backgroundColor = "blue";
            $("box3").style.backgroundColor = "green";
        }
    </script>
</head>
<body>
<div id="box1"></div>
<div id="box2"></div>
<div id="box3"></div>
</body>
</html>